package com.fz.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fz.core.BaseEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

/**
 * <p>
 * 存储商户提交的商品信息
 * </p>
 *
 * @author hyr
 * @since 2025-06-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Goods extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品说明
     */
    private String description;

    /**
     * 商品价格
     */
    private BigDecimal price;

    /**
     * 折扣
     */
    private BigDecimal discount;

    /**
     * 库存
     */
    private Integer store;

    /**
     * 销量
     */
    private Integer sales;

    /**
     * 分类ID（外键）
     */
    private Long categoryId;

    /**
     * 商品图片URL
     */
    private String imgs;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 是否推荐（1=是）
     */
    private Integer recommend;

    /**
     * 状态（1=上架，0=下架）
     */
    private Boolean status;

    /**
     * 修改时间
     */
    private LocalDateTime updateTime;


    @TableField(exist = false)
    String[] imagePathList;

    public Goods(Long id, Boolean status) {
        super(id);
        this.status = status;
    }

    public Goods(Long id, String imgs) {
        super(id);
        this.imgs = imgs;
    }

    public Goods(String name, String description, BigDecimal price, Integer store, Long categoryId) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.store = store;
        this.categoryId = categoryId;
    }

    public Goods(Long id, String name, String description, BigDecimal price, Integer store, Long categoryId) {
        super(id);
        this.name = name;
        this.description = description;
        this.price = price;
        this.store = store;
        this.categoryId = categoryId;
    }

    public Goods(String name, String description, BigDecimal price, Integer store, Long categoryId, String imgs, LocalDateTime createTime) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.store = store;
        this.categoryId = categoryId;
        this.imgs = imgs;
        this.createTime = createTime;
    }
}
